<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="description" content="">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="320">
    <meta name="viewport" content="width=device-width, initial-scale=1, minimal-ui, user-scalable=no">
    <meta http-equiv="cleartype" content="on">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/assets/store_zt/common/css/style.css">
    <link rel="stylesheet" href="/assets/public/layermobile/css/layer.css">
</head>
<div class="wraperr">
    <div class="content content2">
        <div class="top">
            <div class="hint"><img src="/assets/store/common/images/register.png" alt=""/></div>
            <p class="font-18 margin-12">申请注册</p>
        </div>
        <div class="bottom">
            <div class="Information">
                <div class="information name">
                    <div class="icon"><img src="/assets/store/common/images/name.png" alt=""/></div>
                    <div><input id="user_name" type="text" placeholder="请输入您的姓名"/></div>
                </div>
                <div class="information phone border-bottom margin-b-30">
                    <div class="icon"><img src="/assets/store/common/images/phone.png" alt=""/></div>
                    <div><input id="mobile" type="text" placeholder="请输入您的电话号码"/></div>
                </div>

            </div>

            <a href="#" class="btn visit margin-b">确认提交</a>
        </div>
    </div>
</div>

<body>
<script src="/assets/store/common/js/jquery-2.1.3.min.js"></script>
<script src="/assets/public/layermobile/layer.js"></script>
<script>
    $(function () {
        var height = $(window).height();
        $('.wraperr').css('height', height);
        $('.btn').click(function () {
            var user_name = $('#user_name').val();
            var mobile = $('#mobile').val();
            var store_id = "{BEESCRM:$storeId}";
            var sub_account_id = "{BEESCRM:$subAccountId}";

            if (!user_name) {
                layer.open({
                    content: '姓名不能为空！',
                    style: 'background-color:#fff; text-align:center;color:#000; border:none;',
                    time: 2
                });
                return false;
            }

            if (!mobile) {
                layer.open({
                    content: '电话号码不能为空！',
                    style: 'background-color:#fff; text-align:center;color:#000; border:none;',
                    time: 2
                });
                return false;
            }

            var reg = /^0?1[3|4|5|8][0-9]\d{8}$/;
            if (!reg.test(mobile)) {
                layer.open({
                    content: '电话号码格式不正确！',
                    style: 'background-color:#fff; text-align:center;color:#000; border:none;',
                    time: 2
                });
                return false;
            };

            $.ajax({
                type: "POST",
                url: '/base/store/doRemindBind',
                data: {'store_id': store_id, 'user_name': user_name, 'mobile': mobile, 'sub_account_id':sub_account_id},
                dataType: 'json',
                success: function (data) {
                    if (data.status == 'S') {
                        window.location.href = data.url;
                    } else {
                        layer.open({
                            content: data.message,
                            style: 'background-color:#fff; text-align:center;color:#000; border:none;',
                            time: 2
                        });
                    }
                }
            });
        });
    })
</script>
</body>
</html>